#include "POUS.h"
// FUNCTION
BYTE BITS_BYTE(
  BOOL EN, 
  BOOL *__ENO, 
  BOOL BIT0, 
  BOOL BIT1, 
  BOOL BIT2, 
  BOOL BIT3, 
  BOOL BIT4, 
  BOOL BIT5, 
  BOOL BIT6, 
  BOOL BIT7)
{
  BOOL ENO = __BOOL_LITERAL(TRUE);
  BYTE BITS_BYTE = 0;

  // Control execution
  if (!EN) {
    if (__ENO != NULL) {
      *__ENO = __BOOL_LITERAL(FALSE);
    }
    return BITS_BYTE;
  }
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)

    BITS_BYTE|=(BIT0)?1:0;
    BITS_BYTE|=(BIT1)?2:0;
    BITS_BYTE|=(BIT2)?4:0;
    BITS_BYTE|=(BIT3)?8:0;
    BITS_BYTE|=(BIT4)?0x10:0;
    BITS_BYTE|=(BIT5)?0x20:0;
    BITS_BYTE|=(BIT6)?0x40:0;
    BITS_BYTE|=(BIT7)?0x80:0;

  #undef GetFbVar
  #undef SetFbVar
;
  goto __end;

  goto __end;

__end:
  if (__ENO != NULL) {
    *__ENO = ENO;
  }
  return BITS_BYTE;
}


// FUNCTION
WORD BITS_WORD(
  BOOL EN, 
  BOOL *__ENO, 
  BOOL BIT0, 
  BOOL BIT1, 
  BOOL BIT2, 
  BOOL BIT3, 
  BOOL BIT4, 
  BOOL BIT5, 
  BOOL BIT6, 
  BOOL BIT7, 
  BOOL BIT8, 
  BOOL BIT9, 
  BOOL BIT10, 
  BOOL BIT11, 
  BOOL BIT12, 
  BOOL BIT13, 
  BOOL BIT14, 
  BOOL BIT15)
{
  BOOL ENO = __BOOL_LITERAL(TRUE);
  WORD BITS_WORD = 0;

  // Control execution
  if (!EN) {
    if (__ENO != NULL) {
      *__ENO = __BOOL_LITERAL(FALSE);
    }
    return BITS_WORD;
  }
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)

    BITS_WORD|=(BIT0)?1:0;
    BITS_WORD|=(BIT1)?2:0;
    BITS_WORD|=(BIT2)?4:0;
    BITS_WORD|=(BIT3)?8:0;
    BITS_WORD|=(BIT4)?0x10:0;
    BITS_WORD|=(BIT5)?0x20:0;
    BITS_WORD|=(BIT6)?0x40:0;
    BITS_WORD|=(BIT7)?0x80:0;
    BITS_WORD|=(BIT8)?0x100:0;
    BITS_WORD|=(BIT9)?0x200:0;
    BITS_WORD|=(BIT10)?0x400:0;
    BITS_WORD|=(BIT11)?0x800:0;
    BITS_WORD|=(BIT12)?0x1000:0;
    BITS_WORD|=(BIT13)?0x2000:0;
    BITS_WORD|=(BIT14)?0x4000:0;
    BITS_WORD|=(BIT15)?0x8000:0;

  #undef GetFbVar
  #undef SetFbVar
;
  goto __end;

  goto __end;

__end:
  if (__ENO != NULL) {
    *__ENO = ENO;
  }
  return BITS_WORD;
}


// FUNCTION
UDINT TIMESTAMP(
  BOOL EN, 
  BOOL *__ENO, 
  BOOL USERTC)
{
  BOOL ENO = __BOOL_LITERAL(TRUE);
  UDINT TIMESTAMP = 0;

  // Control execution
  if (!EN) {
    if (__ENO != NULL) {
      *__ENO = __BOOL_LITERAL(FALSE);
    }
    return TIMESTAMP;
  }
  #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
  #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)

TIMESTAMP=plc_rte->timestamp();

  #undef GetFbVar
  #undef SetFbVar
;
  goto __end;

  goto __end;

__end:
  if (__ENO != NULL) {
    *__ENO = ENO;
  }
  return TIMESTAMP;
}


void LOGGER_init__(LOGGER *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->TRIG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->MSG,__STRING_LITERAL(0,""),retain)
  __INIT_VAR(data__->LEVEL,LOGLEVEL__INFO,retain)
  __INIT_VAR(data__->TRIG0,__BOOL_LITERAL(FALSE),retain)
}

// Code part
void LOGGER_body__(LOGGER *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables @generate_c.cc L1201

  if ((__GET_VAR(data__->TRIG,) && !(__GET_VAR(data__->TRIG0,)))) {
    #define GetFbVar(var,...) __GET_VAR(data__->var,__VA_ARGS__)
    #define SetFbVar(var,val,...) __SET_VAR(data__->,var,__VA_ARGS__,val)

   LogMessage(GetFbVar(LEVEL),(char*)GetFbVar(MSG, .body),GetFbVar(MSG, .len));
  
    #undef GetFbVar
    #undef SetFbVar
;
  };
  __SET_VAR(data__->,TRIG0,,__GET_VAR(data__->TRIG,));

  goto __end;

__end:
  return;
} // LOGGER_body__() 





void PROC_STATE_init__(PROC_STATE *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ERR_HOME,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->ERR_HOME_ID,0,retain)
  __INIT_VAR(data__->ERR_MOVE,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->ERR_MOVE_ID,0,retain)
  __INIT_VAR(data__->ERR_MOVE1,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->ERR_MOVE2,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->ACT_MOVE,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->ACT_MOVE0,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->OUT,0,retain)
}

// Code part
void PROC_STATE_body__(PROC_STATE *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables @generate_c.cc L1201

  __SET_VAR(data__->,OUT,,0);
  if (__GET_VAR(data__->HOME,)) {
    __SET_VAR(data__->,OUT,,1);
  };
  if (__GET_VAR(data__->ACT_MOVE,)) {
    __SET_VAR(data__->,OUT,,2);
  };
  if (__GET_VAR(data__->ERR_MOVE,)) {
    __SET_VAR(data__->,OUT,, -(WORD_TO_INT(
      (BOOL)__BOOL_LITERAL(TRUE),
      NULL,
      (WORD)__GET_VAR(data__->ERR_MOVE_ID,))));
  };
  if (__GET_VAR(data__->ERR_HOME,)) {
    __SET_VAR(data__->,OUT,, -(WORD_TO_INT(
      (BOOL)__BOOL_LITERAL(TRUE),
      NULL,
      (WORD)__GET_VAR(data__->ERR_HOME_ID,))));
  };

  goto __end;

__end:
  return;
} // PROC_STATE_body__() 





static inline BOOL __STEPPER_MOVE__BOOL__BOOL1(BOOL EN,
  BOOL IN,
  STEPPER *data__)
{
  BOOL __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_MOVE138_ENO,);
  __res = MOVE__BOOL__BOOL(EN,
    &__TMP_ENO,
    IN);
  __SET_VAR(,data__->_TMP_MOVE138_ENO,,__TMP_ENO);
  return __res;
}

void STEPPER_init__(STEPPER *data__, BOOL retain) {
  __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
  __INIT_VAR(data__->AXIS,-1,retain)
  __INIT_VAR(data__->POS,0,retain)
  __INIT_VAR(data__->STATE,0,retain)
  __INIT_VAR(data__->TARGET,0,retain)
  __INIT_VAR(data__->RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->RUNING,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->SPEED,0,retain)
  __INIT_VAR(data__->ASPEED,0,retain)
  __INIT_VAR(data__->HOME,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOMESPEED,0,retain)
  __INIT_VAR(data__->HOMELOOKUP,0,retain)
  __INIT_VAR(data__->XIFEN,0,retain)
  __INIT_VAR(data__->RUN_DIR,MC_DIRECTION__MCABSOLUTEPOSITION,retain)
  __INIT_VAR(data__->HOMEMODE,MC_HOMING_PROCEDURES__MCHOMEDIRECT,retain)
  __INIT_VAR(data__->BUFFMODE,MC_BUFFER_MODE__MCABORTING,retain)
  __INIT_VAR(data__->MC_SETPOSMODE,MC_EXECUTION_MODE__MCIMMEDIATELY,retain)
  MC_WRITEPARAMETER_init__(&data__->MC_WRITEPARAMETER8,retain);
  MC_HOME_init__(&data__->MC_HOME1,retain);
  MC_MOVEABSOLUTE_init__(&data__->MC_MOVEABSOLUTE3,retain);
  MC_POWER_init__(&data__->MC_POWER3,retain);
  MC_READACTUALPOSITION_init__(&data__->MC_READACTUALPOSITION3,retain);
  PROC_STATE_init__(&data__->PROC_STATE3,retain);
  MC_SETPOSITION_init__(&data__->MC_SETPOSITION3,retain);
  MC_WRITEPARAMETER_init__(&data__->MC_WRITEPARAMETER0,retain);
  MC_WRITEPARAMETER_init__(&data__->MC_WRITEPARAMETER6,retain);
  R_TRIG_init__(&data__->R_TRIG0,retain);
  __INIT_VAR(data__->_TMP_MOVE138_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOVE138_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_OR222_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_DIV167_OUT,0,retain)
}

// Code part
void STEPPER_body__(STEPPER *data__) {
  // Control execution
  if (!__GET_VAR(data__->EN)) {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(FALSE));
    return;
  }
  else {
    __SET_VAR(data__->,ENO,,__BOOL_LITERAL(TRUE));
  }
  // Initialise TEMP variables @generate_c.cc L1201

  __SET_VAR(data__->MC_READACTUALPOSITION3.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_READACTUALPOSITION3.,ENABLE,,__GET_VAR(data__->MC_POWER3.STATUS,));
  MC_READACTUALPOSITION_body__(&data__->MC_READACTUALPOSITION3);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_READACTUALPOSITION3.AXIS));
  __SET_VAR(data__->,POS,,__GET_VAR(data__->MC_READACTUALPOSITION3.POSITION,));
  __SET_VAR(data__->,_TMP_MOVE138_OUT,,__STEPPER_MOVE__BOOL__BOOL1(
    (BOOL)__GET_VAR(data__->MC_MOVEABSOLUTE3.DONE,),
    (BOOL)0,
    data__));
  if (__GET_VAR(data__->_TMP_MOVE138_ENO,)) {
    __SET_VAR(data__->,RUN,,__GET_VAR(data__->_TMP_MOVE138_OUT,));
  };
  __SET_VAR(data__->PROC_STATE3.,ERR_HOME,,__GET_VAR(data__->MC_HOME1.ERROR,));
  __SET_VAR(data__->PROC_STATE3.,ERR_HOME_ID,,__GET_VAR(data__->MC_HOME1.ERRORID,));
  __SET_VAR(data__->PROC_STATE3.,ERR_MOVE,,__GET_VAR(data__->MC_MOVEABSOLUTE3.ERROR,));
  __SET_VAR(data__->PROC_STATE3.,HOME,,__GET_VAR(data__->MC_HOME1.ACTIVE,));
  __SET_VAR(data__->PROC_STATE3.,ACT_MOVE,,__GET_VAR(data__->MC_MOVEABSOLUTE3.ACTIVE,));
  PROC_STATE_body__(&data__->PROC_STATE3);
  __SET_VAR(data__->,STATE,,__GET_VAR(data__->PROC_STATE3.OUT,));
  __SET_VAR(data__->,_TMP_OR222_OUT,,OR__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->MC_MOVEABSOLUTE3.BUSY,),
    (BOOL)__GET_VAR(data__->MC_HOME1.BUSY,)));
  __SET_VAR(data__->,RUNING,,__GET_VAR(data__->_TMP_OR222_OUT,));
  __SET_VAR(data__->MC_POWER3.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_POWER3.,ENABLE,,1);
  __SET_VAR(data__->MC_POWER3.,ENABLEPOSITIVE,,1);
  __SET_VAR(data__->MC_POWER3.,ENABLENEGATIVE,,1);
  MC_POWER_body__(&data__->MC_POWER3);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_POWER3.AXIS));
  __SET_VAR(data__->MC_HOME1.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_HOME1.,EXECUTE,,__GET_VAR(data__->MC_WRITEPARAMETER0.DONE,));
  __SET_VAR(data__->MC_HOME1.,HOMINGMODE,,__GET_VAR(data__->HOMEMODE,));
  __SET_VAR(data__->MC_HOME1.,BUFFERMODE,,__GET_VAR(data__->BUFFMODE,));
  MC_HOME_body__(&data__->MC_HOME1);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_HOME1.AXIS));
  __SET_VAR(data__->MC_SETPOSITION3.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_SETPOSITION3.,EXECUTE,,__GET_VAR(data__->MC_HOME1.DONE,));
  __SET_VAR(data__->MC_SETPOSITION3.,POSITION,,0.0);
  __SET_VAR(data__->MC_SETPOSITION3.,EXECUTIONMODE,,__GET_VAR(data__->MC_SETPOSMODE,));
  MC_SETPOSITION_body__(&data__->MC_SETPOSITION3);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_SETPOSITION3.AXIS));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,EXECUTE,,__GET_VAR(data__->R_TRIG0.Q,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,CONTINUOUSUPDATE,,1);
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,POSITION,,__GET_VAR(data__->TARGET,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,VELOCITY,,__GET_VAR(data__->SPEED,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,ACCELERATION,,__GET_VAR(data__->_TMP_DIV167_OUT,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,DECELERATION,,__GET_VAR(data__->_TMP_DIV167_OUT,));
  __SET_VAR(data__->MC_MOVEABSOLUTE3.,DIRECTION,,__GET_VAR(data__->RUN_DIR,));
  MC_MOVEABSOLUTE_body__(&data__->MC_MOVEABSOLUTE3);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_MOVEABSOLUTE3.AXIS));
  __SET_VAR(data__->R_TRIG0.,CLK,,__GET_VAR(data__->RUN,));
  R_TRIG_body__(&data__->R_TRIG0);
  __SET_VAR(data__->,_TMP_DIV167_OUT,,DIV__REAL__REAL__REAL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (REAL)__GET_VAR(data__->SPEED,),
    (REAL)__GET_VAR(data__->ASPEED,)));
  __SET_VAR(data__->MC_WRITEPARAMETER8.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_WRITEPARAMETER8.,EXECUTE,,__GET_VAR(data__->HOME,));
  __SET_VAR(data__->MC_WRITEPARAMETER8.,PARAMETERNUMBER,,1018);
  __SET_VAR(data__->MC_WRITEPARAMETER8.,VALUE,,__GET_VAR(data__->HOMELOOKUP,));
  MC_WRITEPARAMETER_body__(&data__->MC_WRITEPARAMETER8);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_WRITEPARAMETER8.AXIS));
  __SET_VAR(data__->MC_WRITEPARAMETER0.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_WRITEPARAMETER0.,EXECUTE,,__GET_VAR(data__->MC_WRITEPARAMETER8.DONE,));
  __SET_VAR(data__->MC_WRITEPARAMETER0.,PARAMETERNUMBER,,1010);
  __SET_VAR(data__->MC_WRITEPARAMETER0.,VALUE,,__GET_VAR(data__->HOMESPEED,));
  MC_WRITEPARAMETER_body__(&data__->MC_WRITEPARAMETER0);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_WRITEPARAMETER0.AXIS));
  __SET_VAR(data__->MC_WRITEPARAMETER6.,AXIS,,__GET_VAR(data__->AXIS,));
  __SET_VAR(data__->MC_WRITEPARAMETER6.,EXECUTE,,__GET_VAR(data__->MC_POWER3.STATUS,));
  __SET_VAR(data__->MC_WRITEPARAMETER6.,PARAMETERNUMBER,,1003);
  __SET_VAR(data__->MC_WRITEPARAMETER6.,VALUE,,__GET_VAR(data__->XIFEN,));
  MC_WRITEPARAMETER_body__(&data__->MC_WRITEPARAMETER6);
  __SET_VAR(data__->,AXIS,,__GET_VAR(data__->MC_WRITEPARAMETER6.AXIS));

  goto __end;

__end:
  return;
} // STEPPER_body__() 





static inline INT __PROGRAM0_ADD__INT__INT1(BOOL EN,
  UINT __PARAM_COUNT,
  INT IN1,
  INT IN2,
  PROGRAM0 *data__)
{
  INT __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_ADD165_ENO,);
  __res = ADD__INT__INT(EN,
    &__TMP_ENO,
    __PARAM_COUNT,
    IN1,
    IN2);
  __SET_VAR(,data__->_TMP_ADD165_ENO,,__TMP_ENO);
  return __res;
}

static inline REAL __PROGRAM0_ADD__REAL__REAL2(BOOL EN,
  UINT __PARAM_COUNT,
  REAL IN1,
  REAL IN2,
  PROGRAM0 *data__)
{
  REAL __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_ADD126_ENO,);
  __res = ADD__REAL__REAL(EN,
    &__TMP_ENO,
    __PARAM_COUNT,
    IN1,
    IN2);
  __SET_VAR(,data__->_TMP_ADD126_ENO,,__TMP_ENO);
  return __res;
}

static inline BYTE __PROGRAM0_MOVE__BYTE__BYTE3(BOOL EN,
  BYTE IN,
  PROGRAM0 *data__)
{
  BYTE __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_MOVE128_ENO,);
  __res = MOVE__BYTE__BYTE(EN,
    &__TMP_ENO,
    IN);
  __SET_VAR(,data__->_TMP_MOVE128_ENO,,__TMP_ENO);
  return __res;
}

static inline BOOL __PROGRAM0_MOVE__BOOL__BOOL4(BOOL EN,
  BOOL IN,
  PROGRAM0 *data__)
{
  BOOL __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_MOVE168_ENO,);
  __res = MOVE__BOOL__BOOL(EN,
    &__TMP_ENO,
    IN);
  __SET_VAR(,data__->_TMP_MOVE168_ENO,,__TMP_ENO);
  return __res;
}

static inline REAL __PROGRAM0_MUL__REAL__REAL5(BOOL EN,
  UINT __PARAM_COUNT,
  REAL IN1,
  REAL IN2,
  PROGRAM0 *data__)
{
  REAL __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_MUL123_ENO,);
  __res = MUL__REAL__REAL(EN,
    &__TMP_ENO,
    __PARAM_COUNT,
    IN1,
    IN2);
  __SET_VAR(,data__->_TMP_MUL123_ENO,,__TMP_ENO);
  return __res;
}

static inline INT __PROGRAM0_REAL_TO_INT6(BOOL EN,
  REAL IN,
  PROGRAM0 *data__)
{
  INT __res;
  BOOL __TMP_ENO = __GET_VAR(data__->_TMP_REAL_TO_INT125_ENO,);
  __res = REAL_TO_INT(EN,
    &__TMP_ENO,
    IN);
  __SET_VAR(,data__->_TMP_REAL_TO_INT125_ENO,,__TMP_ENO);
  return __res;
}

void PROGRAM0_init__(PROGRAM0 *data__, BOOL retain) {
  __INIT_VAR(data__->M1_SPEED,100.0,retain)
  __INIT_VAR(data__->M1_POS,0,retain)
  __INIT_VAR(data__->M1_POS_SET,0,retain)
  __INIT_VAR(data__->M1_ASPEED,1.0,retain)
  __INIT_VAR(data__->M1_RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->M1_STATUS,0,retain)
  __INIT_VAR(data__->HOME1,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME2,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME3,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME6,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME7,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->HOME_SPEED1,50.0,1)
  __INIT_VAR(data__->HOME_SPEED2,50.0,1)
  __INIT_VAR(data__->HOME_SPEED3,50.0,1)
  __INIT_VAR(data__->HOME_SPEED6,50.0,1)
  __INIT_VAR(data__->HOME_SPEED7,2.0,1)
  __INIT_VAR(data__->HOME_SPEED_BACK1,10.0,1)
  __INIT_VAR(data__->HOME_SPEED_BACK2,10.0,1)
  __INIT_VAR(data__->HOME_SPEED_BACK3,5.0,1)
  __INIT_VAR(data__->HOME_SPEED_BACK6,10.0,1)
  __INIT_VAR(data__->HOME_SPEED_BACK7,6.0,1)
  __INIT_VAR(data__->XIFEN1,1066.0,1)
  __INIT_VAR(data__->XIFEN2,355.0,1)
  __INIT_VAR(data__->XIFEN3,1066.0,1)
  __INIT_VAR(data__->XIFEN6,160.0,1)
  __INIT_VAR(data__->XIFEN7,4266.0,1)
  __INIT_VAR(data__->M2_SPEED,100.0,1)
  __INIT_VAR(data__->M2_POS,0,retain)
  __INIT_VAR(data__->M2_POS_SET,0,retain)
  __INIT_VAR(data__->M2_ASPEED,1.0,1)
  __INIT_VAR(data__->M2_STATUS,0,retain)
  __INIT_VAR(data__->M2_RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->M3_SPEED,100.0,1)
  __INIT_VAR(data__->M3_POS,0,retain)
  __INIT_VAR(data__->M3_POS_SET,0,retain)
  __INIT_VAR(data__->M3_ASPEED,1.0,1)
  __INIT_VAR(data__->M3_STATUS,0,retain)
  __INIT_VAR(data__->M3_RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->M3_DELAY,0.1,1)
  __INIT_VAR(data__->M4_FORCE,0,retain)
  __INIT_VAR(data__->M4_ACT,1,retain)
  __INIT_VAR(data__->M4_POS,0,retain)
  __INIT_VAR(data__->M4_SPEED,0,retain)
  __INIT_VAR(data__->M4_RUN,0,retain)
  __INIT_VAR(data__->M4_MODE,0,retain)
  __INIT_VAR(data__->M4_STATUS,0,retain)
  __INIT_LOCATED(WORD,__IW4_0_0_20,data__->M5_SPEED,retain)
  __INIT_LOCATED_VALUE(data__->M5_SPEED,0)
  __INIT_LOCATED(WORD,__IW4_0_0_33,data__->M5_POS,retain)
  __INIT_LOCATED_VALUE(data__->M5_POS,0)
  __INIT_LOCATED(WORD,__QW4_0_2_20,data__->M5_SPEED_SET,1)
  __INIT_LOCATED_VALUE(data__->M5_SPEED_SET,500)
  __INIT_LOCATED(WORD,__QW4_0_1_32,data__->M5_POS_SET,retain)
  __INIT_LOCATED_VALUE(data__->M5_POS_SET,0)
  __INIT_LOCATED(WORD,__IW4_0_0_36,data__->M5_STATUS,retain)
  __INIT_LOCATED_VALUE(data__->M5_STATUS,0)
  __INIT_VAR(data__->M6_SPEED,100.0,1)
  __INIT_VAR(data__->M6_POS,0,retain)
  __INIT_VAR(data__->M6_POS_SET,0,retain)
  __INIT_VAR(data__->M6_ASPEED,1.0,1)
  __INIT_VAR(data__->M6_STATUS,0,retain)
  __INIT_VAR(data__->M6_RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->M7_SPEED,6.0,1)
  __INIT_VAR(data__->M7_POS,0,retain)
  __INIT_VAR(data__->M7_POS_SET,0,retain)
  __INIT_VAR(data__->M7_ASPEED,0.1,1)
  __INIT_VAR(data__->M7_STATUS,0,retain)
  __INIT_VAR(data__->M7_RUN,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->M8_POS,0,retain)
  __INIT_VAR(data__->M8_SPEED,127,1)
  __INIT_VAR(data__->M8_FORCE,255,1)
  __INIT_VAR(data__->M8_ACT,1,1)
  __INIT_VAR(data__->M8_MODE,1,1)
  __INIT_VAR(data__->M8_RUN,0,retain)
  __INIT_VAR(data__->M8_STATUS,0,retain)
  __INIT_VAR(data__->M9_ACT,1,1)
  __INIT_VAR(data__->M9_SPEED,88,1)
  __INIT_VAR(data__->M9_FORCE,255,1)
  __INIT_VAR(data__->M9_RUN,0,retain)
  __INIT_VAR(data__->M9_POS,0,retain)
  __INIT_VAR(data__->M9_STATUS,0,retain)
  __INIT_VAR(data__->LIANDONG,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->LIANDONG_POS,0,retain)
  __INIT_VAR(data__->M9_SCALE,90.0,1)
  __INIT_VAR(data__->M7_DELAY,0.48,1)
  __INIT_LOCATED(BOOL,__IX1_1_1,data__->X1,retain)
  __INIT_LOCATED_VALUE(data__->X1,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__IX1_1_2,data__->X2,retain)
  __INIT_LOCATED_VALUE(data__->X2,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__IX1_1_3,data__->X3,retain)
  __INIT_LOCATED_VALUE(data__->X3,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__IX1_1_4,data__->X4,retain)
  __INIT_LOCATED_VALUE(data__->X4,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__IX1_1_5,data__->X5,retain)
  __INIT_LOCATED_VALUE(data__->X5,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__IX1_1_6,data__->X6,retain)
  __INIT_LOCATED_VALUE(data__->X6,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(WORD,__MW3_0_0_1000,data__->MB3_HR_1000,retain)
  __INIT_LOCATED_VALUE(data__->MB3_HR_1000,0)
  __INIT_LOCATED(WORD,__MW3_0_0_1001,data__->MB3_HR_1001,retain)
  __INIT_LOCATED_VALUE(data__->MB3_HR_1001,0)
  __INIT_LOCATED(WORD,__MW3_0_0_1002,data__->MB3_HR_1002,retain)
  __INIT_LOCATED_VALUE(data__->MB3_HR_1002,0)
  __INIT_LOCATED(WORD,__MW3_0_0_1003,data__->MB3_HR_1003,retain)
  __INIT_LOCATED_VALUE(data__->MB3_HR_1003,0)
  __INIT_LOCATED(WORD,__IW3_0_1_2000,data__->MB3_HR_2000,retain)
  __INIT_LOCATED_VALUE(data__->MB3_HR_2000,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2000,data__->MB_HR_2000,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2000,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2001,data__->MB_HR_2001,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2001,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2002,data__->MB_HR_2002,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2002,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2003,data__->MB_HR_2003,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2003,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2004,data__->MB_HR_2004,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2004,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2005,data__->MB_HR_2005,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2005,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2006,data__->MB_HR_2006,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2006,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2007,data__->MB_HR_2007,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2007,0)
  __INIT_LOCATED(WORD,__IW2_1_0_2008,data__->MB_HR_2008,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_2008,0)
  __INIT_LOCATED(WORD,__MW2_1_2_1000,data__->MB_HR_1000,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1000,0)
  __INIT_LOCATED(WORD,__MW2_1_2_1001,data__->MB_HR_1001,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1001,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1002,data__->MB_HR_1002,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1002,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1003,data__->MB_HR_1003,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1003,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1004,data__->MB_HR_1004,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1004,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1005,data__->MB_HR_1005,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1005,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1006,data__->MB_HR_1006,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1006,0)
  __INIT_LOCATED(WORD,__MW2_1_1_1007,data__->MB_HR_1007,retain)
  __INIT_LOCATED_VALUE(data__->MB_HR_1007,0)
  __INIT_LOCATED(INT,__IW2_1_0_0_7,data__->MB_2_1_0_STATUS,retain)
  __INIT_LOCATED_VALUE(data__->MB_2_1_0_STATUS,0)
  __INIT_LOCATED(UDINT,__ID2_1_0_0_8,data__->MB_2_1_0_COUNT,retain)
  __INIT_LOCATED_VALUE(data__->MB_2_1_0_COUNT,0)
  __INIT_LOCATED(UDINT,__ID2_1_0_0_9,data__->MB_2_1_0_COUNT0,retain)
  __INIT_LOCATED_VALUE(data__->MB_2_1_0_COUNT0,0)
  __INIT_LOCATED(INT,__IW3_0_1_0_7,data__->MB_3_0_1_STATUS,retain)
  __INIT_LOCATED_VALUE(data__->MB_3_0_1_STATUS,0)
  __INIT_LOCATED(UDINT,__ID3_0_1_0_8,data__->MB_3_0_1_COUNT,retain)
  __INIT_LOCATED_VALUE(data__->MB_3_0_1_COUNT,0)
  __INIT_LOCATED(UDINT,__ID3_0_1_0_9,data__->MB_3_0_1_COUNT0,retain)
  __INIT_LOCATED_VALUE(data__->MB_3_0_1_COUNT0,0)
  __INIT_LOCATED(INT,__IW4_0_0_0_7,data__->MB_4_0_0_STATUS,retain)
  __INIT_LOCATED_VALUE(data__->MB_4_0_0_STATUS,0)
  __INIT_LOCATED(UDINT,__ID4_0_0_0_8,data__->MB_4_0_0_COUNT,retain)
  __INIT_LOCATED_VALUE(data__->MB_4_0_0_COUNT,0)
  __INIT_LOCATED(UDINT,__ID4_0_0_0_9,data__->MB_4_0_0_COUNT0,retain)
  __INIT_LOCATED_VALUE(data__->MB_4_0_0_COUNT0,0)
  STEPPER_init__(&data__->STEPPER0,retain);
  __INIT_VAR(data__->AXIS1,0,retain)
  __INIT_VAR(data__->AXIS2,1,retain)
  __INIT_VAR(data__->AXIS3,2,retain)
  __INIT_VAR(data__->AXIS4,3,retain)
  __INIT_VAR(data__->AXIS5,4,retain)
  __INIT_VAR(data__->AXIS6,5,retain)
  STEPPER_init__(&data__->STEPPER1,retain);
  STEPPER_init__(&data__->STEPPER2,retain);
  STEPPER_init__(&data__->STEPPER3,retain);
  STEPPER_init__(&data__->STEPPER4,retain);
  __INIT_LOCATED(BOOL,__QX1_2_1,data__->Y1,retain)
  __INIT_LOCATED_VALUE(data__->Y1,__BOOL_LITERAL(FALSE))
  __INIT_LOCATED(BOOL,__QX1_2_2,data__->Y2,retain)
  __INIT_LOCATED_VALUE(data__->Y2,__BOOL_LITERAL(FALSE))
  __INIT_VAR(data__->HOME_P,MC_HOMING_PROCEDURES__MCHOMEABSOLUTESWITCHPOSITIVE,retain)
  __INIT_VAR(data__->HOME_N,MC_HOMING_PROCEDURES__MCHOMEABSOLUTESWITCHNEGATIVE,retain)
  __INIT_VAR(data__->DIRC_P,MC_DIRECTION__MCPOSITIVEDIRECTION,retain)
  __INIT_VAR(data__->DIRC_N,MC_DIRECTION__MCNEGATIVEDIRECTION,retain)
  TON_init__(&data__->TON0,retain);
  TON_init__(&data__->TON1,retain);
  R_TRIG_init__(&data__->R_TRIG0,retain);
  RS_init__(&data__->RS0,retain);
  TON_init__(&data__->TON2,retain);
  F_TRIG_init__(&data__->F_TRIG0,retain);
  R_TRIG_init__(&data__->R_TRIG1,retain);
  R_TRIG_init__(&data__->R_TRIG2,retain);
  __INIT_VAR(data__->TON1_Q,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->TON2_Q,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_ADD165_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_ADD165_OUT,0,retain)
  __INIT_VAR(data__->_TMP_ADD126_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_ADD126_OUT,0,retain)
  __INIT_VAR(data__->_TMP_MOVE128_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOVE128_OUT,0,retain)
  __INIT_VAR(data__->_TMP_MOVE168_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOVE168_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD43_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD47_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD67_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD15_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD19_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD25_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BITS_WORD23_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD29_OUT,0,retain)
  __INIT_VAR(data__->_TMP_INT_TO_WORD58_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_2_WORD60_OUT,0,retain)
  __INIT_VAR(data__->_TMP_OR172_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_REAL_TO_TIME164_OUT,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
  __INIT_VAR(data__->_TMP_MUL123_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MUL123_OUT,0,retain)
  __INIT_VAR(data__->_TMP_REAL_TO_INT125_ENO,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_REAL_TO_INT125_OUT,0,retain)
  __INIT_VAR(data__->_TMP_REAL_TO_TIME161_OUT,__time_to_timespec(1, 0, 0, 0, 0, 0),retain)
  __INIT_VAR(data__->_TMP_BITS_BYTE78_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_TO_BOOL77_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_BITS_BYTE50_OUT,0,retain)
  __INIT_VAR(data__->_TMP_BYTE_TO_BOOL49_OUT,__BOOL_LITERAL(FALSE),retain)
  __INIT_VAR(data__->_TMP_MOD56_OUT,0,retain)
  __INIT_VAR(data__->_TMP_DIV63_OUT,0,retain)
  __INIT_VAR(data__->_TMP_INT_TO_BYTE65_OUT,0,retain)
}

// Code part
void PROGRAM0_body__(PROGRAM0 *data__) {
  // Initialise TEMP variables in generate_c.cc L1389

  __SET_VAR(data__->STEPPER1.,AXIS,,__GET_VAR(data__->AXIS2,));
  __SET_VAR(data__->STEPPER1.,TARGET,,__GET_VAR(data__->M2_POS_SET,));
  __SET_VAR(data__->STEPPER1.,RUN,,__GET_VAR(data__->M2_RUN,));
  __SET_VAR(data__->STEPPER1.,SPEED,,__GET_VAR(data__->M2_SPEED,));
  __SET_VAR(data__->STEPPER1.,ASPEED,,__GET_VAR(data__->M2_ASPEED,));
  __SET_VAR(data__->STEPPER1.,HOME,,__GET_VAR(data__->HOME2,));
  __SET_VAR(data__->STEPPER1.,HOMESPEED,,__GET_VAR(data__->HOME_SPEED2,));
  __SET_VAR(data__->STEPPER1.,HOMELOOKUP,,__GET_VAR(data__->HOME_SPEED_BACK2,));
  __SET_VAR(data__->STEPPER1.,XIFEN,,__GET_VAR(data__->XIFEN2,));
  __SET_VAR(data__->STEPPER1.,RUN_DIR,,__GET_VAR(data__->DIRC_N,));
  __SET_VAR(data__->STEPPER1.,HOMEMODE,,__GET_VAR(data__->HOME_P,));
  STEPPER_body__(&data__->STEPPER1);
  __SET_VAR(data__->,M2_RUN,,__GET_VAR(data__->STEPPER1.RUN));
  __SET_VAR(data__->,HOME2,,__GET_VAR(data__->STEPPER1.HOME));
  __SET_VAR(data__->,M2_POS,,__GET_VAR(data__->STEPPER1.POS,));
  __SET_VAR(data__->,TON1_Q,,__GET_VAR(data__->TON1.Q,));
  __SET_VAR(data__->,TON2_Q,,__GET_VAR(data__->TON2.Q,));
  __SET_VAR(data__->STEPPER2.,AXIS,,__GET_VAR(data__->AXIS3,));
  __SET_VAR(data__->STEPPER2.,TARGET,,__GET_VAR(data__->M3_POS_SET,));
  __SET_VAR(data__->STEPPER2.,RUN,,__GET_VAR(data__->TON1_Q,));
  __SET_VAR(data__->STEPPER2.,SPEED,,__GET_VAR(data__->M3_SPEED,));
  __SET_VAR(data__->STEPPER2.,ASPEED,,__GET_VAR(data__->M3_ASPEED,));
  __SET_VAR(data__->STEPPER2.,HOME,,__GET_VAR(data__->TON2_Q,));
  __SET_VAR(data__->STEPPER2.,HOMESPEED,,__GET_VAR(data__->HOME_SPEED3,));
  __SET_VAR(data__->STEPPER2.,HOMELOOKUP,,__GET_VAR(data__->HOME_SPEED_BACK3,));
  __SET_VAR(data__->STEPPER2.,XIFEN,,__GET_VAR(data__->XIFEN3,));
  __SET_VAR(data__->STEPPER2.,RUN_DIR,,__GET_VAR(data__->DIRC_P,));
  __SET_VAR(data__->STEPPER2.,HOMEMODE,,__GET_VAR(data__->HOME_P,));
  STEPPER_body__(&data__->STEPPER2);
  __SET_VAR(data__->,TON1_Q,,__GET_VAR(data__->STEPPER2.RUN));
  __SET_VAR(data__->,TON2_Q,,__GET_VAR(data__->STEPPER2.HOME));
  __SET_VAR(data__->,M3_POS,,__GET_VAR(data__->STEPPER2.POS,));
  __SET_VAR(data__->RS0.,S,,__GET_VAR(data__->_TMP_OR172_OUT,));
  __SET_VAR(data__->RS0.,R1,,__GET_VAR(data__->F_TRIG0.Q,));
  RS_body__(&data__->RS0);
  __SET_LOCATED(data__->,Y1,,__GET_VAR(data__->RS0.Q1,));
  __SET_VAR(data__->STEPPER0.,AXIS,,__GET_VAR(data__->AXIS1,));
  __SET_VAR(data__->STEPPER0.,TARGET,,__GET_VAR(data__->M1_POS_SET,));
  __SET_VAR(data__->STEPPER0.,RUN,,__GET_VAR(data__->M1_RUN,));
  __SET_VAR(data__->STEPPER0.,SPEED,,__GET_VAR(data__->M1_SPEED,));
  __SET_VAR(data__->STEPPER0.,ASPEED,,__GET_VAR(data__->M1_ASPEED,));
  __SET_VAR(data__->STEPPER0.,HOME,,__GET_VAR(data__->HOME1,));
  __SET_VAR(data__->STEPPER0.,HOMESPEED,,__GET_VAR(data__->HOME_SPEED1,));
  __SET_VAR(data__->STEPPER0.,HOMELOOKUP,,__GET_VAR(data__->HOME_SPEED_BACK1,));
  __SET_VAR(data__->STEPPER0.,XIFEN,,__GET_VAR(data__->XIFEN1,));
  __SET_VAR(data__->STEPPER0.,RUN_DIR,,__GET_VAR(data__->DIRC_P,));
  __SET_VAR(data__->STEPPER0.,HOMEMODE,,__GET_VAR(data__->HOME_N,));
  STEPPER_body__(&data__->STEPPER0);
  __SET_VAR(data__->,M1_RUN,,__GET_VAR(data__->STEPPER0.RUN));
  __SET_VAR(data__->,HOME1,,__GET_VAR(data__->STEPPER0.HOME));
  __SET_VAR(data__->,M1_POS,,__GET_VAR(data__->STEPPER0.POS,));
  __SET_VAR(data__->,M2_STATUS,,__GET_VAR(data__->STEPPER1.STATE,));
  __SET_VAR(data__->,M1_STATUS,,__GET_VAR(data__->STEPPER0.STATE,));
  __SET_VAR(data__->,M3_STATUS,,__GET_VAR(data__->STEPPER2.STATE,));
  __SET_VAR(data__->,HOME2,,__GET_VAR(data__->STEPPER1.HOME,));
  __SET_VAR(data__->,HOME1,,__GET_VAR(data__->STEPPER0.HOME,));
  __SET_VAR(data__->STEPPER4.,AXIS,,__GET_VAR(data__->AXIS5,));
  __SET_VAR(data__->STEPPER4.,TARGET,,__GET_VAR(data__->M7_POS_SET,));
  __SET_VAR(data__->STEPPER4.,RUN,,__GET_VAR(data__->M7_RUN,));
  __SET_VAR(data__->STEPPER4.,SPEED,,__GET_VAR(data__->M7_SPEED,));
  __SET_VAR(data__->STEPPER4.,ASPEED,,__GET_VAR(data__->M7_ASPEED,));
  __SET_VAR(data__->STEPPER4.,HOME,,__GET_VAR(data__->HOME7,));
  __SET_VAR(data__->STEPPER4.,HOMESPEED,,__GET_VAR(data__->HOME_SPEED7,));
  __SET_VAR(data__->STEPPER4.,HOMELOOKUP,,__GET_VAR(data__->HOME_SPEED_BACK7,));
  __SET_VAR(data__->STEPPER4.,XIFEN,,__GET_VAR(data__->XIFEN7,));
  __SET_VAR(data__->STEPPER4.,RUN_DIR,,__GET_VAR(data__->DIRC_P,));
  __SET_VAR(data__->STEPPER4.,HOMEMODE,,__GET_VAR(data__->HOME_P,));
  STEPPER_body__(&data__->STEPPER4);
  __SET_VAR(data__->,M7_RUN,,__GET_VAR(data__->STEPPER4.RUN));
  __SET_VAR(data__->,HOME7,,__GET_VAR(data__->STEPPER4.HOME));
  __SET_VAR(data__->,M7_POS,,__GET_VAR(data__->STEPPER4.POS,));
  __SET_VAR(data__->STEPPER3.,AXIS,,__GET_VAR(data__->AXIS4,));
  __SET_VAR(data__->STEPPER3.,TARGET,,__GET_VAR(data__->M6_POS_SET,));
  __SET_VAR(data__->STEPPER3.,RUN,,__GET_VAR(data__->M6_RUN,));
  __SET_VAR(data__->STEPPER3.,SPEED,,__GET_VAR(data__->M6_SPEED,));
  __SET_VAR(data__->STEPPER3.,ASPEED,,__GET_VAR(data__->M6_ASPEED,));
  __SET_VAR(data__->STEPPER3.,HOME,,__GET_VAR(data__->HOME6,));
  __SET_VAR(data__->STEPPER3.,HOMESPEED,,__GET_VAR(data__->HOME_SPEED6,));
  __SET_VAR(data__->STEPPER3.,HOMELOOKUP,,__GET_VAR(data__->HOME_SPEED_BACK6,));
  __SET_VAR(data__->STEPPER3.,XIFEN,,__GET_VAR(data__->XIFEN6,));
  __SET_VAR(data__->STEPPER3.,RUN_DIR,,__GET_VAR(data__->DIRC_N,));
  __SET_VAR(data__->STEPPER3.,HOMEMODE,,__GET_VAR(data__->HOME_N,));
  STEPPER_body__(&data__->STEPPER3);
  __SET_VAR(data__->,M6_RUN,,__GET_VAR(data__->STEPPER3.RUN));
  __SET_VAR(data__->,HOME6,,__GET_VAR(data__->STEPPER3.HOME));
  __SET_VAR(data__->,M6_POS,,__GET_VAR(data__->STEPPER3.POS,));
  __SET_VAR(data__->,M7_STATUS,,__GET_VAR(data__->STEPPER4.STATE,));
  __SET_VAR(data__->,M6_STATUS,,__GET_VAR(data__->STEPPER3.STATE,));
  __SET_VAR(data__->,HOME7,,__GET_VAR(data__->STEPPER4.HOME,));
  __SET_VAR(data__->,HOME6,,__GET_VAR(data__->STEPPER3.HOME,));
  __SET_VAR(data__->,_TMP_ADD165_OUT,,__PROGRAM0_ADD__INT__INT1(
    (BOOL)__GET_VAR(data__->_TMP_REAL_TO_INT125_ENO,),
    (UINT)2,
    (INT)__GET_VAR(data__->_TMP_REAL_TO_INT125_OUT,),
    (INT)__GET_VAR(data__->M9_POS,),
    data__));
  if (__GET_VAR(data__->_TMP_ADD165_ENO,)) {
    __SET_VAR(data__->,M9_POS,,__GET_VAR(data__->_TMP_ADD165_OUT,));
  };
  __SET_VAR(data__->,_TMP_ADD126_OUT,,__PROGRAM0_ADD__REAL__REAL2(
    (BOOL)__GET_VAR(data__->R_TRIG0.Q,),
    (UINT)2,
    (REAL)__GET_VAR(data__->LIANDONG_POS,),
    (REAL)__GET_VAR(data__->M7_POS_SET,),
    data__));
  if (__GET_VAR(data__->_TMP_ADD126_ENO,)) {
    __SET_VAR(data__->,M7_POS_SET,,__GET_VAR(data__->_TMP_ADD126_OUT,));
  };
  __SET_VAR(data__->,_TMP_MOVE128_OUT,,__PROGRAM0_MOVE__BYTE__BYTE3(
    (BOOL)__GET_VAR(data__->R_TRIG0.Q,),
    (BYTE)1,
    data__));
  if (__GET_VAR(data__->_TMP_MOVE128_ENO,)) {
    __SET_VAR(data__->,M9_RUN,,__GET_VAR(data__->_TMP_MOVE128_OUT,));
  };
  __SET_VAR(data__->,_TMP_MOVE168_OUT,,__PROGRAM0_MOVE__BOOL__BOOL4(
    (BOOL)__GET_VAR(data__->TON0.Q,),
    (BOOL)1,
    data__));
  if (__GET_VAR(data__->_TMP_MOVE168_ENO,)) {
    __SET_VAR(data__->,M7_RUN,,__GET_VAR(data__->_TMP_MOVE168_OUT,));
  };
  __SET_VAR(data__->,_TMP_BYTE_2_WORD43_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M4_POS,),
    (BYTE)__GET_VAR(data__->M4_SPEED,)));
  __SET_LOCATED(data__->,MB3_HR_1002,,__GET_VAR(data__->_TMP_BYTE_2_WORD43_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD47_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->_TMP_BITS_BYTE78_OUT,),
    (BYTE)__GET_VAR(data__->M4_MODE,)));
  __SET_LOCATED(data__->,MB3_HR_1000,,__GET_VAR(data__->_TMP_BYTE_2_WORD47_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD67_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M4_RUN,),
    (BYTE)__GET_VAR(data__->M4_FORCE,)));
  __SET_LOCATED(data__->,MB3_HR_1003,,__GET_VAR(data__->_TMP_BYTE_2_WORD67_OUT,));
  __SET_VAR(data__->,M4_STATUS,,__GET_LOCATED(data__->MB3_HR_2000,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD15_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M8_POS,),
    (BYTE)__GET_VAR(data__->M8_SPEED,)));
  __SET_LOCATED(data__->,MB_HR_1002,,__GET_VAR(data__->_TMP_BYTE_2_WORD15_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD19_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->_TMP_BITS_BYTE50_OUT,),
    (BYTE)__GET_VAR(data__->M8_MODE,)));
  __SET_LOCATED(data__->,MB_HR_1000,,__GET_VAR(data__->_TMP_BYTE_2_WORD19_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD25_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M8_RUN,),
    (BYTE)__GET_VAR(data__->M8_FORCE,)));
  __SET_LOCATED(data__->,MB_HR_1003,,__GET_VAR(data__->_TMP_BYTE_2_WORD25_OUT,));
  __SET_VAR(data__->,M8_STATUS,,__GET_LOCATED(data__->MB_HR_2000,));
  __SET_VAR(data__->,_TMP_BITS_WORD23_OUT,,BITS_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->M9_ACT,),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE),
    (BOOL)__BOOL_LITERAL(FALSE)));
  __SET_LOCATED(data__->,MB_HR_1001,,__GET_VAR(data__->_TMP_BITS_WORD23_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD29_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M9_SPEED,),
    (BYTE)__GET_VAR(data__->M9_FORCE,)));
  __SET_LOCATED(data__->,MB_HR_1005,,__GET_VAR(data__->_TMP_BYTE_2_WORD29_OUT,));
  __SET_VAR(data__->,_TMP_INT_TO_WORD58_OUT,,INT_TO_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->_TMP_MOD56_OUT,)));
  __SET_LOCATED(data__->,MB_HR_1006,,__GET_VAR(data__->_TMP_INT_TO_WORD58_OUT,));
  __SET_LOCATED(data__->,MB_HR_1004,,__GET_VAR(data__->_TMP_INT_TO_WORD58_OUT,));
  __SET_VAR(data__->,_TMP_BYTE_2_WORD60_OUT,,BYTE_2_WORD(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M9_RUN,),
    (BYTE)__GET_VAR(data__->_TMP_INT_TO_BYTE65_OUT,)));
  __SET_LOCATED(data__->,MB_HR_1007,,__GET_VAR(data__->_TMP_BYTE_2_WORD60_OUT,));
  __SET_VAR(data__->,M9_STATUS,,__GET_LOCATED(data__->MB_HR_2001,));
  __SET_VAR(data__->R_TRIG1.,CLK,,__GET_VAR(data__->M3_RUN,));
  R_TRIG_body__(&data__->R_TRIG1);
  __SET_VAR(data__->,_TMP_OR172_OUT,,OR__BOOL__BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (UINT)2,
    (BOOL)__GET_VAR(data__->R_TRIG1.Q,),
    (BOOL)__GET_VAR(data__->R_TRIG2.Q,)));
  __SET_VAR(data__->R_TRIG2.,CLK,,__GET_VAR(data__->HOME3,));
  R_TRIG_body__(&data__->R_TRIG2);
  __SET_VAR(data__->TON1.,IN,,__GET_VAR(data__->M3_RUN,));
  __SET_VAR(data__->TON1.,PT,,__GET_VAR(data__->_TMP_REAL_TO_TIME164_OUT,));
  TON_body__(&data__->TON1);
  __SET_VAR(data__->F_TRIG0.,CLK,,__GET_VAR(data__->STEPPER2.RUNING,));
  F_TRIG_body__(&data__->F_TRIG0);
  __SET_VAR(data__->,_TMP_REAL_TO_TIME164_OUT,,REAL_TO_TIME(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (REAL)__GET_VAR(data__->M3_DELAY,)));
  __SET_VAR(data__->TON2.,IN,,__GET_VAR(data__->HOME3,));
  __SET_VAR(data__->TON2.,PT,,__GET_VAR(data__->_TMP_REAL_TO_TIME164_OUT,));
  TON_body__(&data__->TON2);
  __SET_VAR(data__->R_TRIG0.,CLK,,__GET_VAR(data__->LIANDONG,));
  R_TRIG_body__(&data__->R_TRIG0);
  __SET_VAR(data__->,_TMP_MUL123_OUT,,__PROGRAM0_MUL__REAL__REAL5(
    (BOOL)__GET_VAR(data__->R_TRIG0.Q,),
    (UINT)2,
    (REAL)__GET_VAR(data__->LIANDONG_POS,),
    (REAL)__GET_VAR(data__->M9_SCALE,),
    data__));
  __SET_VAR(data__->,_TMP_REAL_TO_INT125_OUT,,__PROGRAM0_REAL_TO_INT6(
    (BOOL)__GET_VAR(data__->_TMP_MUL123_ENO,),
    (REAL)__GET_VAR(data__->_TMP_MUL123_OUT,),
    data__));
  __SET_VAR(data__->TON0.,IN,,__GET_VAR(data__->LIANDONG,));
  __SET_VAR(data__->TON0.,PT,,__GET_VAR(data__->_TMP_REAL_TO_TIME161_OUT,));
  TON_body__(&data__->TON0);
  __SET_VAR(data__->,_TMP_REAL_TO_TIME161_OUT,,REAL_TO_TIME(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (REAL)__GET_VAR(data__->M7_DELAY,)));
  __SET_VAR(data__->,_TMP_BITS_BYTE78_OUT,,BITS_BYTE(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->M4_ACT,),
    (BOOL)1,
    (BOOL)0,
    (BOOL)__GET_VAR(data__->_TMP_BYTE_TO_BOOL77_OUT,),
    (BOOL)0,
    (BOOL)0,
    (BOOL)0,
    (BOOL)0));
  __SET_VAR(data__->,_TMP_BYTE_TO_BOOL77_OUT,,BYTE_TO_BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M4_RUN,)));
  __SET_VAR(data__->,_TMP_BITS_BYTE50_OUT,,BITS_BYTE(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BOOL)__GET_VAR(data__->M8_ACT,),
    (BOOL)1,
    (BOOL)0,
    (BOOL)__GET_VAR(data__->_TMP_BYTE_TO_BOOL49_OUT,),
    (BOOL)0,
    (BOOL)0,
    (BOOL)0,
    (BOOL)0));
  __SET_VAR(data__->,_TMP_BYTE_TO_BOOL49_OUT,,BYTE_TO_BOOL(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (BYTE)__GET_VAR(data__->M8_RUN,)));
  __SET_VAR(data__->,_TMP_MOD56_OUT,,MOD__INT__INT__INT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->M9_POS,),
    (INT)360));
  __SET_VAR(data__->,_TMP_DIV63_OUT,,DIV__INT__INT__INT(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->M9_POS,),
    (INT)360));
  __SET_VAR(data__->,_TMP_INT_TO_BYTE65_OUT,,INT_TO_BYTE(
    (BOOL)__BOOL_LITERAL(TRUE),
    NULL,
    (INT)__GET_VAR(data__->_TMP_DIV63_OUT,)));

  goto __end;

__end:
  return;
} // PROGRAM0_body__() 





void PROGRAM0_Input(PROGRAM0 *data__){
__SET_LOCATED(data__->,M5_SPEED,,fast_input(4,0,0,20,0));
__SET_LOCATED(data__->,M5_POS,,fast_input(4,0,0,33,0));
__SET_LOCATED(data__->,M5_STATUS,,fast_input(4,0,0,36,0));
__SET_LOCATED(data__->,X1,,fast_input(1,1,1,0,0));
__SET_LOCATED(data__->,X2,,fast_input(1,1,2,0,0));
__SET_LOCATED(data__->,X3,,fast_input(1,1,3,0,0));
__SET_LOCATED(data__->,X4,,fast_input(1,1,4,0,0));
__SET_LOCATED(data__->,X5,,fast_input(1,1,5,0,0));
__SET_LOCATED(data__->,X6,,fast_input(1,1,6,0,0));
__SET_LOCATED(data__->,MB3_HR_1000,,fast_input(3,0,0,1000,0));
__SET_LOCATED(data__->,MB3_HR_1001,,fast_input(3,0,0,1001,0));
__SET_LOCATED(data__->,MB3_HR_1002,,fast_input(3,0,0,1002,0));
__SET_LOCATED(data__->,MB3_HR_1003,,fast_input(3,0,0,1003,0));
__SET_LOCATED(data__->,MB3_HR_2000,,fast_input(3,0,1,2000,0));
__SET_LOCATED(data__->,MB_HR_2000,,fast_input(2,1,0,2000,0));
__SET_LOCATED(data__->,MB_HR_2001,,fast_input(2,1,0,2001,0));
__SET_LOCATED(data__->,MB_HR_2002,,fast_input(2,1,0,2002,0));
__SET_LOCATED(data__->,MB_HR_2003,,fast_input(2,1,0,2003,0));
__SET_LOCATED(data__->,MB_HR_2004,,fast_input(2,1,0,2004,0));
__SET_LOCATED(data__->,MB_HR_2005,,fast_input(2,1,0,2005,0));
__SET_LOCATED(data__->,MB_HR_2006,,fast_input(2,1,0,2006,0));
__SET_LOCATED(data__->,MB_HR_2007,,fast_input(2,1,0,2007,0));
__SET_LOCATED(data__->,MB_HR_2008,,fast_input(2,1,0,2008,0));
__SET_LOCATED(data__->,MB_HR_1000,,fast_input(2,1,2,1000,0));
__SET_LOCATED(data__->,MB_HR_1001,,fast_input(2,1,2,1001,0));
__SET_LOCATED(data__->,MB_HR_1002,,fast_input(2,1,1,1002,0));
__SET_LOCATED(data__->,MB_HR_1003,,fast_input(2,1,1,1003,0));
__SET_LOCATED(data__->,MB_HR_1004,,fast_input(2,1,1,1004,0));
__SET_LOCATED(data__->,MB_HR_1005,,fast_input(2,1,1,1005,0));
__SET_LOCATED(data__->,MB_HR_1006,,fast_input(2,1,1,1006,0));
__SET_LOCATED(data__->,MB_HR_1007,,fast_input(2,1,1,1007,0));
__SET_LOCATED(data__->,MB_2_1_0_STATUS,,fast_input(2,1,0,0,7));
__SET_LOCATED(data__->,MB_2_1_0_COUNT,,fast_input(2,1,0,0,8));
__SET_LOCATED(data__->,MB_2_1_0_COUNT0,,fast_input(2,1,0,0,9));
__SET_LOCATED(data__->,MB_3_0_1_STATUS,,fast_input(3,0,1,0,7));
__SET_LOCATED(data__->,MB_3_0_1_COUNT,,fast_input(3,0,1,0,8));
__SET_LOCATED(data__->,MB_3_0_1_COUNT0,,fast_input(3,0,1,0,9));
__SET_LOCATED(data__->,MB_4_0_0_STATUS,,fast_input(4,0,0,0,7));
__SET_LOCATED(data__->,MB_4_0_0_COUNT,,fast_input(4,0,0,0,8));
__SET_LOCATED(data__->,MB_4_0_0_COUNT0,,fast_input(4,0,0,0,9));
}
void PROGRAM0_Output(PROGRAM0 *data__){
fast_output(4,0,2,20,0,__GET_LOCATED(data__->M5_SPEED_SET,));
fast_output(4,0,1,32,0,__GET_LOCATED(data__->M5_POS_SET,));
fast_output(1,2,1,0,0,__GET_LOCATED(data__->Y1,));
fast_output(1,2,2,0,0,__GET_LOCATED(data__->Y2,));
}